<template>
  <div class="dashboard-editor-container">
    <el-row :gutter="16">
      <el-col :span="18">
        <el-card class="box-card">
          <template #header>
            <div>
              <span>数据看板</span>
            </div>
          </template>
          <el-row :gutter="40" class="panel-group">
            <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
              <div class="card-panel">
                <div class="card-panel-icon-wrapper icon-people">
                  <svg-icon icon-class="receive" class-name="card-panel-icon"/>
                </div>
                <div class="card-panel-description">
                  <div class="card-panel-text">今日收入（实得）</div>
                  <span class="card-panel-num">
                    <vue-count-to :start-val="0.00" :end-val="100" :decimals="2"/>
                  </span>
                </div>
              </div>
            </el-col>
            <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
              <div class="card-panel">
                <div class="card-panel-icon-wrapper icon-bag">
                  <svg-icon icon-class="turnover" class-name="card-panel-icon"/>
                </div>
                <div class="card-panel-description">
                  <div class="card-panel-text">营业额（订单金额）</div>
                  <span class="card-panel-num">
                    <vue-count-to :start-val="0.00" :end-val="100" :decimals="2"/>
                  </span>
                </div>
              </div>
            </el-col>
            <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
              <div class="card-panel">
                <div class="card-panel-icon-wrapper icon-money">
                  <svg-icon icon-class="completed" class-name="card-panel-icon"/>
                </div>
                <div class="card-panel-description">
                  <div class="card-panel-text">订单数量</div>
                  <span class="card-panel-num">
                    <vue-count-to :start-val="0" :end-val="100"/>
                  </span>
                </div>
              </div>
            </el-col>
            <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
              <div class="card-panel">
                <div class="card-panel-icon-wrapper icon-completed">
                  <svg-icon icon-class="completed" class-name="card-panel-icon"/>
                </div>
                <div class="card-panel-description">
                  <div class="card-panel-text">完成订单数</div>
                  <span class="card-panel-num">
                    <vue-count-to :start-val="0" :end-val="100"/>
                  </span>
                </div>
              </div>
            </el-col>
          </el-row>
        </el-card>
        <el-row :gutter="16" class="panel-group">
          <el-col :span="12">
            <el-card class="box-card">
              <template #header>
                <div>
                  <span>会员充值总金额</span>
                </div>
              </template>
              <div class="card-panel card-panel2">
                <div class="card-panel-icon-wrapper icon-completed">
                  <svg-icon icon-class="wallet" class-name="card-panel-icon"/>
                </div>
                <div class="card-panel-description card-panel-description2">
                  <div class="card-panel-num">
                    <vue-count-to :start-val="0.00" :end-val="100" :decimals="2"/>
                  </div>
                </div>
              </div>
            </el-card>
          </el-col>
          <el-col :span="12">
            <el-card class="box-card">
              <template #header>
                <div>
                  <span>会员消费金额</span>
                </div>
              </template>
              <div class="card-panel card-panel2">
                <div class="card-panel-icon-wrapper icon-money">
                  <svg-icon icon-class="consumption" class-name="card-panel-icon"/>
                </div>
                <div class="card-panel-description card-panel-description2">
                  <div class="card-panel-num">
                    <vue-count-to :start-val="0.00" :end-val="100" :decimals="2"/>
                  </div>
                </div>
              </div>
            </el-card>
          </el-col>
          <el-col :span="12">
            <el-card class="box-card">
              <template #header>
                <div>
                  <span>次卡发放数量</span>
                </div>
              </template>
              <div class="card-panel card-panel2">
                <div class="card-panel-icon-wrapper icon-bag">
                  <svg-icon icon-class="timescard" class-name="card-panel-icon"/>
                </div>
                <div class="card-panel-description card-panel-description2">
                  <div class="card-panel-num">
                    <vue-count-to :start-val="0" :end-val="100"/>
                  </div>
                </div>
              </div>
            </el-card>
          </el-col>
          <el-col :span="12">
            <el-card class="box-card">
              <template #header>
                <div>
                  <span>次卡激活数量</span>
                </div>
              </template>
              <div class="card-panel card-panel2">
                <div class="card-panel-icon-wrapper icon-people">
                  <svg-icon icon-class="cardactive" class-name="card-panel-icon"/>
                </div>
                <div class="card-panel-description card-panel-description2">
                  <div class="card-panel-num">
                    <vue-count-to :start-val="0" :end-val="100"/>
                  </div>
                </div>
              </div>
            </el-card>
          </el-col>
        </el-row>
      </el-col>
      <el-col :span="6">
        <transaction-table/>
      </el-col>
    </el-row>
  </div>
</template>

<script setup>
import VueCountTo from "@/components/VueCountTo";
import TransactionTable from './components/TransactionTable.vue';

</script>

<style lang="scss" scoped>
.app-main {
  background-color: #F0F2F5;
}

.dashboard-editor-container {
  // background-color: rgb(240, 242, 245);
  position: relative;

  .github-corner {
    position: absolute;
    top: 0;
    border: 0;
    right: 0;
  }

  .chart-wrapper {
    background: #fff;
    padding: 16px 16px 0;
    margin-bottom: 32px;
  }
}

@media (max-width: 1024px) {
  .chart-wrapper {
    padding: 8px;
  }
}

.box-card {
  margin-bottom: 16px;
}

.panel-group {
  margin-top: 18px;

  .card-panel-col {
    margin-bottom: 32px;
  }

  .card-panel2 {
    color: #666;
    background: none !important;
    box-shadow: none !important;
    display: flex;
    justify-content: center;
  }

  .card-panel {
    height: 108px;
    cursor: pointer;
    font-size: 12px;
    position: relative;
    overflow: hidden;
    color: #666;
    background: #fff;
    box-shadow: 4px 4px 40px rgba(0, 0, 0, 0.05);
    border-color: rgba(0, 0, 0, 0.05);

    &:hover {
      .card-panel-icon-wrapper {
        color: #fff;
      }

      .icon-people {
        background: #40c9c6;
      }

      .icon-bag {
        background: #36a3f7;
      }

      .icon-money {
        background: #f4516c;
      }

      .icon-money {
        background: #f4516c;
      }

      .icon-completed {
        background: #34bfa3;
      }
    }

    .icon-people {
      color: #40c9c6;
    }

    .icon-bag {
      color: #36a3f7;
    }

    .icon-money {
      color: #f4516c;
    }

    .icon-completed {
      color: #34bfa3;
    }

    .card-panel-icon-wrapper {
      float: left;
      margin: 14px 0 0 14px;
      padding: 16px;
      transition: all 0.38s ease-out;
      border-radius: 6px;
    }

    .card-panel-icon {
      float: left;
      font-size: 48px;
    }

    .card-panel-description {
      float: right;
      font-weight: bold;
      margin: 26px;
      margin-left: 0px;

      .card-panel-text {
        line-height: 18px;
        color: rgba(0, 0, 0, 0.45);
        font-size: 16px;
        margin-bottom: 12px;
      }

      .card-panel-num {
        font-size: 20px;
      }
    }

    .card-panel-description2 {
      display: flex;
      flex-direction: row;
      align-items: center;

      .card-panel-num {
        margin-left: 16px;
      }
    }

  }
}

@media (max-width: 550px) {
  .card-panel-description {
    display: none;
  }

  .card-panel-icon-wrapper {
    float: none !important;
    width: 100%;
    height: 100%;
    margin: 0 !important;

    .svg-icon {
      display: block;
      margin: 14px auto !important;
      float: none !important;
    }
  }
}
</style>
